#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1010,mod = 1e9+7;
int n,k,a[N],f[N][N],g[N][N],G[N][N],fac[N],sum,o,cnt,o1;
inline int ksm(int x,int p)
{
	int ans = 1;
	while(p)
	{
		if((p&1)) ans = ans*x%mod;
		x = x*x%mod;
		p>>=1;
	}
	return ans;
}
signed main()
{
    freopen("game1.in","r",stdin);
//    freopen("game.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> k; fac[0] = 1;
	for(int i = 1;i <= n;i++) cin >> a[i],f[i][i] = a[i],fac[i] = fac[i-1]*i%mod;
	sum = fac[n-1]*ksm(fac[n-k-1],mod-2)%mod;
	G[0][0] = 1;
	for(int i = 1;i <= n;i++)
		for(int j = 0;j <= i-1;j++)
			G[i][j] = fac[i-1]*ksm(fac[i-j-1],mod-2)%mod,cout<<i<<" "<<j<<" $ "<<G[i][j]<<endl;
	for(int i = n;i >= 1;i--)
		for(int j = i+1;j <= n;j++)
			for(int z = i;z < j;z++)
				f[i][j] = (f[i][j]+f[i][z]*G[(j-z)][j-z-1]%mod-f[z+1][j]*G[(z-i+1)][z-i]%mod)%mod;
	for(int i = 1;i <= n;i++)
		for(int j = i;j <= n;j++)
			cout<<i<<" "<<j<<" "<<f[i][j]<<'\n';
	for(int i = 1;i <= n;i++)
		for(int j = 0;j <= min(i-1,k);j++)
		{
			g[i][j] = (g[i-1][j]+a[i]*G[i-1][j]%mod)%mod;
			for(int z = 0;z+1 < i;z++)
				if(j>=(i-z-1))
					g[i][j] = (g[i][j]+f[z+1][i]*G[z][j-(i-z-1)]%mod+g[z][j-(i-z-1)]*G[i-z][i-z-1]%mod)%mod;
			//cout<<g[i][j]<<" "<<i<<" "<<j<<'\n';
		}
	cout<<g[n][k]*ksm(sum,mod-2)%mod;
    return 0;
}
